<template>
  <div>
    <h2>=========组件2==============</h2>
    <p>count: {{ $store.state.count }}</p>
    <p>
      <button @click="increment(10)">count+10</button>
      <button @click="increment(20)">count+20</button>
    </p>
    <p>全局count: {{ count }}</p>
  </div>
</template>

<script>
export default {
  name: "comp",
  methods:{
    increment(num){
      this.$store.commit("incrementNum", num)
    }
  }
}
</script>

<style scoped>

</style>